﻿/*****************************************************************************
	SNEGA STG GAME ENGINE 0.7a
	Copyright (C) 2009, Xiaohan Tian (snega0223)
	
	http://code.google.com/p/sng-actionscript-stg-engine/
	
	This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License(LGPL) as
	published by the Free Software Foundation, either version 3 of the 
	License, or(at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU Lesser General Public License for more details.
	
	You should have received a copy of the GNU Lesser General Public License
	along with this program.  If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/

package com.sng.stg.game.event 
{
	import com.sng.stg.game.enemy.Enemy;
	import com.sng.stg.game.enemy.EnemyType1;
	import com.sng.stg.game.StageViewer;
	import flash.display.BitmapData;
	
	/**
	 * ...
	 * @author snega
	 */
	public class CreateEnemy extends GameEvent
	{
		protected var _enemy:Enemy = null;
		
		public function CreateEnemy(time:int) 
		{
			super(time);
		}
		
		override public function load(node:XML, currStage:StageViewer):void {
			trace("type = " + node.type.toString());
			trace("image = " + node.image.toString());
			trace("life = " + node.life.toString());
			
			this._enemy = new EnemyType1(currStage, node, currStage._imageBitmapMap[node.image.toString()], currStage._imageBitmapMap[node.image.toString() + "_killed"]);

		}
		
		override public function execute(currStage:StageViewer):void {
			trace("[Event] (" + currStage._time + ") Hit CreateEnemy ");
			
			this._enemy.start(currStage);
		}
		
	}
	
}